import '../model/school_stage_model.dart';
import '../utils/request.dart';

///学校学段API
class SchoolStageApi {
  SchoolStageApi._();

  static final _signleton = SchoolStageApi._();

  factory SchoolStageApi() => _signleton;

  ///获取学校学段列表
  Future<List<SchoolStageRes>> stagesBySchool(final String schoolId) =>
      request.getHandler(path: '/school/$schoolId/stages').then((res) {
        final items = res.toList;
        if (items.isNotEmpty) {
          return items.map((item) => SchoolStageRes.fromMap(item)).toList();
        }
        return [];
      });
}

///学校学段单例
final schoolStageApi = SchoolStageApi();
